import React from 'react';
// import {withRouter} from 'react-router-dom';
import {useHistory} from 'react-router';
import {Iprops,IroutesItem} from '../router/index.d';
import style from './Footer.module.scss';
const Footer:React.FC<Iprops> = props=>{
    const history = useHistory();
    const path = history.location.pathname;
    return <div className={style.footer}>
        {
            props.routes.map((item:IroutesItem,index)=>{
                return <dl 
                    className={item.path === path ? style.active : ""}
                    key={index} 
                    onClick={()=>{history.replace(item.path)}}
                    >
                    {/* <dt><item.meta.icon/></dt> */}
                    <dt>
                        <i className={["iconfont",item.meta.icon].join(' ')}></i>
                    </dt>
                    <dd>{item.meta.title}</dd>
                </dl>
            })
        }
    </div>
}

export default Footer